package com.kunya.product.controller.portall;

import com.kunya.common.common.ServerResponse;
import com.kunya.common.util.CommonUtil;
import com.kunya.product.po.FriendLink;
import com.kunya.product.service.IFriendLinkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author zhangjiaqing
 * @Description:
 * @date 2018/7/14 14:06
 */
@RestController
@RequestMapping("/friendlink")
public class FriendLinkController {
    @Autowired
    private IFriendLinkService iFriendLinkService;
    /*
     *1删除友情链接
     */
    @RequestMapping("/removeFriendLink")
    public ServerResponse deleteByPrimaryKey(Long friendlinkId, HttpServletRequest httpServletRequest){
        return iFriendLinkService.removeFriendLink(friendlinkId, "340_");
    }

    /*
     *2.新增友情链接列表
     */
    @RequestMapping("/addFriendLink")
    public ServerResponse<FriendLink> insertSelective(FriendLink friendLink, HttpServletRequest httpServletRequest){
        return iFriendLinkService.addFriendLink(friendLink,"340_");
    }

    /*
     * 3查询
     */
    @RequestMapping("/findFriendLink")
    public ServerResponse selectByPrimaryKey(Long friendlinkId,HttpServletRequest httpServletRequest){
        return iFriendLinkService.findFriendLink(friendlinkId,"340_");
    }

    /*
     *4.修改
     */
    @RequestMapping("/updateFriendLink")
    public ServerResponse<FriendLink> updateByPrimaryKeySelective(FriendLink friendLink, HttpServletRequest httpServletRequest){
        return iFriendLinkService.updateFriendLink(friendLink,"340_");
    }

    /*
     * 5.查询
     */
    @RequestMapping("/getFriendLink")
    public ServerResponse selectByFriendLink(Long friendlinkId,HttpServletRequest httpServletRequest){
        return iFriendLinkService.getFriendLink(friendlinkId,"340_");
    }
}
